<template>
  <div>
    <my-header></my-header>

    <h3>新闻</h3>
    <div class="box" v-for="v in news" :key="v" @click="fun(v.id)">
      <h2>{{ v.newsTitle }}</h2>
      <p>{{ v.newsDate }}</p>
      <!-- <img :src="v.newsPics" alt=""> -->
      <p>点击数:{{ v.newsClickNum }}</p>
    </div>
  </div>
</template>

<script>
export default {
  name: "news",
  data() {
    return {
      news: [],
      cmt: [],
      children: [],
    };
  },
  methods: {
    fun(id) {
      this.$router.push({ name: "newsss", params: { id: id } });
    },
  },
  created() {
    this.$axios.get("/api/news/findAll/1/4").then((res) => {
      console.log(res.data.data);
      this.news = res.data.data;
    });
    this.$axios.get("/api/comment/findIdAndArticleId/1/4/5").then((res) => {
      console.log(res.data.data);
      this.cmt = res.data.data;
    });
  },
};
</script>

<style scoped>
.box {
  max-width: 800px;
  max-height: 400px;
  border: 1px solid red;
  margin: auto;
  margin-top: 20px;
}
.boxs {
  max-width: 1400px;
  max-height: 1400px;
  border: 1px solid blue;
  margin: auto;
}
</style>
